# coding=utf-8
# python原生支持闭包
# __closure__ 查看闭包内容


def add():
    sum = 0

    def f(value):
        nonlocal sum
        sum += value
        return sum

    return f
